package com.googlecode.grtframework.log;

import java.util.Enumeration;
import java.util.Vector;

/**
 * Process display output by sending log messages to a GRTLogger.
 * 
 * The GRTLogger passes these messages off to LoggerListeners, which can display
 * it.
 * 
 * Messages types can be selected for logging... A loggerListener simply stops
 * displaying new data.
 * 
 * OR: GRTLogger stops ending?
 * 
 * 
 * 
 * @author ajc
 * 
 */
public class GRTLogger {

	private Vector listeners;

	public GRTLogger() {
		listeners = new Vector();
	}

	public void addLoggerListener(LoggerListener l) {
		listeners.add(l);
	}

	public void log(String id, String message) {
		Log l = new Log(id, message);
		for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
			((LoggerListener) e.nextElement()).logRecieved(l);
		}
	}

}
